/************************************************************************

								Heroes IV
					  Copyright 2001, The 3DO Company

	------------------------------------------------------------------
  						       dialog_choose_lord.h

	$Header:  $

	$NoKeywords: $

 ************************************************************************/

#ifndef DIALOG_CHOOSE_LORD_H_INCLUDED
#define DIALOG_CHOOSE_LORD_H_INCLUDED


#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <list>
#include <vector>

#include "bitmap_layer_cache_window_ptr.h"
#include "bitmap_layer_window_ptr.h"
#include "bitmap_group_ptr.h"
#include "button_ptr.h"
#include "game_window.h"
#include "scrollbar_ptr.h"
#include "text_window_ptr.h"

class t_abstract_town;
class t_hero;

// ---------------------------------------------------------------------------
// Dialog to select new lord(s) for a town
// ---------------------------------------------------------------------------
class t_dialog_choose_lord : public t_window
{
	public:
		t_dialog_choose_lord( std::vector< t_hero * > const & lords,
							  t_abstract_town *       town,
							  t_window *              parent );

	private:
		enum { k_displayed_heroes = 4 }; // Number of heroes visible at one time

		// All the stuff needed to display one hero
		struct t_hero_display
		{
			int					hero_index; // Index in m_heroes
			t_button_ptr		hero_button;
			std::list<t_bitmap_layer_cache_window_ptr> hero_portrait_images;
			t_text_window_ptr   hero_name;
			t_text_window_ptr   hero_skill;
			t_text_window_ptr   current_town;
		};

		void cancel_clicked( t_button * );
		void hero_clicked( t_button *, int display_index );
		void ok_clicked( t_button * );
		void scrollbar_change( t_scrollbar *, int position );
		void update_all_displays();
		void update_display( int display_index );

		t_bitmap_group_ptr		m_bitmaps;
		int						m_current_selection; // Index in m_heroes
		t_hero_display          m_hero_display[ k_displayed_heroes ];
		std::vector< t_hero * > m_heroes;
		t_scrollbar_ptr			m_scrollbar;
		t_abstract_town *       m_town;
};


#endif // DIALOG_CHOOSE_LORD_H_INCLUDED
